/*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004-2005 ActivMedia Robotics LLC
Copyright (C) 2006-2010 MobileRobots Inc.
Copyright (C) 2011-2014 Adept Technology

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

If you wish to redistribute ARIA under different terms, contact 
Adept MobileRobots for information about a commercial version of ARIA at 
robots@mobilerobots.com or 
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.40
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package com.mobilerobots.Aria;

public class ArDeviceConnection {
  /* (begin code from javabody typemap) */

  private long swigCPtr;
  protected boolean swigCMemOwn;

  /* for internal use by swig only */
  public ArDeviceConnection(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  /* for internal use by swig only */
  public static long getCPtr(ArDeviceConnection obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  /* (end code from javabody typemap) */

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        AriaJavaJNI.delete_ArDeviceConnection(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public int read(String data, long size, long msWait) {
    return AriaJavaJNI.ArDeviceConnection_read__SWIG_0(swigCPtr, this, data, size, msWait);
  }

  public int read(String data, long size) {
    return AriaJavaJNI.ArDeviceConnection_read__SWIG_1(swigCPtr, this, data, size);
  }

  public int writePacket(ArBasePacket packet) {
    return AriaJavaJNI.ArDeviceConnection_writePacket(swigCPtr, this, ArBasePacket.getCPtr(packet), packet);
  }

  public int write(String data, long size) {
    return AriaJavaJNI.ArDeviceConnection_write(swigCPtr, this, data, size);
  }

  public int getStatus() {
    return AriaJavaJNI.ArDeviceConnection_getStatus(swigCPtr, this);
  }

  public String getStatusMessage(int messageNumber) {
    return AriaJavaJNI.ArDeviceConnection_getStatusMessage(swigCPtr, this, messageNumber);
  }

  public boolean openSimple() {
    return AriaJavaJNI.ArDeviceConnection_openSimple(swigCPtr, this);
  }

  public boolean close() {
    return AriaJavaJNI.ArDeviceConnection_close(swigCPtr, this);
  }

  public String getOpenMessage(int messageNumber) {
    return AriaJavaJNI.ArDeviceConnection_getOpenMessage(swigCPtr, this, messageNumber);
  }

  public ArTime getTimeRead(int index) {
    return new ArTime(AriaJavaJNI.ArDeviceConnection_getTimeRead(swigCPtr, this, index), true);
  }

  public boolean isTimeStamping() {
    return AriaJavaJNI.ArDeviceConnection_isTimeStamping(swigCPtr, this);
  }

  public String getPortName() {
    return AriaJavaJNI.ArDeviceConnection_getPortName(swigCPtr, this);
  }

  public String getPortType() {
    return AriaJavaJNI.ArDeviceConnection_getPortType(swigCPtr, this);
  }

  public void setDeviceName(String deviceName) {
    AriaJavaJNI.ArDeviceConnection_setDeviceName(swigCPtr, this, deviceName);
  }

  public String getDeviceName() {
    return AriaJavaJNI.ArDeviceConnection_getDeviceName(swigCPtr, this);
  }

  public void debugStartPacket() {
    AriaJavaJNI.ArDeviceConnection_debugStartPacket(swigCPtr, this);
  }

  public void debugBytesRead(int bytesRead) {
    AriaJavaJNI.ArDeviceConnection_debugBytesRead(swigCPtr, this, bytesRead);
  }

  public void debugEndPacket(boolean goodPacket, int type) {
    AriaJavaJNI.ArDeviceConnection_debugEndPacket__SWIG_0(swigCPtr, this, goodPacket, type);
  }

  public void debugEndPacket(boolean goodPacket) {
    AriaJavaJNI.ArDeviceConnection_debugEndPacket__SWIG_1(swigCPtr, this, goodPacket);
  }

  public static boolean debugShouldLog(boolean shouldLog) {
    return AriaJavaJNI.ArDeviceConnection_debugShouldLog(shouldLog);
  }

  public final static class Status {
    public final static Status STATUS_NEVER_OPENED = new Status("STATUS_NEVER_OPENED", AriaJavaJNI.ArDeviceConnection_STATUS_NEVER_OPENED_get());
    public final static Status STATUS_OPEN = new Status("STATUS_OPEN");
    public final static Status STATUS_OPEN_FAILED = new Status("STATUS_OPEN_FAILED");
    public final static Status STATUS_CLOSED_NORMALLY = new Status("STATUS_CLOSED_NORMALLY");
    public final static Status STATUS_CLOSED_ERROR = new Status("STATUS_CLOSED_ERROR");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static Status swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + Status.class + " with value " + swigValue);
    }

    private Status(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private Status(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private Status(String swigName, Status swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static Status[] swigValues = { STATUS_NEVER_OPENED, STATUS_OPEN, STATUS_OPEN_FAILED, STATUS_CLOSED_NORMALLY, STATUS_CLOSED_ERROR };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
